/*
 * CombatInformationDialog.java
 *
 * Created on 13 de abril de 2008, 14:57
 */

package org.perfectday.main.dummyengine.model;


import java.util.List;
import javax.swing.event.TableModelListener;
import javax.swing.table.TableModel;



/**
 *
 * @author  Miguel Angel Lopez Montellano ( alakat@gmail.com )
 */
public class CombatInformationDialog extends javax.swing.JDialog {
    
    private InformationModel info;
    class InformationModel implements TableModel{
        
        private String[] columnName =  {"Descripción"};
        private String data[][];

        public InformationModel(String[][] data) {
            this.data = data;
        }

        public InformationModel( List<String> data) {
            this.data = new String[2][data.size()];
            for (int i = 0; i < data.size(); i++) {
                String string = data.get(i);
               // this.data[0][i]=""+i;
                this.data[0][i]=string;
            }
        }

        
        public void addTableModelListener(TableModelListener l) {
            
        }

        public Class<?> getColumnClass(int columnIndex) {
            return String.class;
        }

        public int getColumnCount() {
            return 1;
        }

        public String getColumnName(int columnIndex) {
            return columnName[columnIndex];
        }

        public int getRowCount() {
            return data[0].length;
        }

        public Object getValueAt(int rowIndex, int columnIndex) {
            return data[columnIndex][rowIndex];
        }

        public boolean isCellEditable(int rowIndex, int columnIndex) {
           return false;
        }

        public void removeTableModelListener(TableModelListener l) {
            
        }

        public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
            
        }
        
    }
    /** Creates new form CombatInformationDialog */
    public CombatInformationDialog(java.awt.Frame parent, boolean modal,String imgBackground,List<String> paper) {
        super(parent, modal);
        this.info = new InformationModel(paper);
        initComponents();
        this.combatInformationPanel1.setImage(imgBackground);
        this.combatInformationPanel1.setInfo(paper);
        this.bAceptarr.setFocusable(true);
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        combatInformationPanel1 = new org.perfectday.main.dummyengine.model.CombatInformationPanel();
        bAceptarr = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Información del combate");
        addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                formKeyPressed(evt);
            }
        });

        combatInformationPanel1.setPreferredSize(new java.awt.Dimension(300, 420));

        bAceptarr.setText("Aceptar");
        bAceptarr.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bAceptarrActionPerformed(evt);
            }
        });

        jTable1.setModel(this.info);
        jScrollPane1.setViewportView(jTable1);
        jTable1.setColumnModel(jTable1.getColumnModel());

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(169, 169, 169)
                        .addComponent(bAceptarr))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(combatInformationPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE))))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(combatInformationPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 298, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(bAceptarr)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void bAceptarrActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bAceptarrActionPerformed
        // TODO add your handling code here:
        this.dispose();
    }//GEN-LAST:event_bAceptarrActionPerformed

    private void formKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_formKeyPressed
        // TODO add your handling code here:
      
    }//GEN-LAST:event_formKeyPressed

    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bAceptarr;
    private org.perfectday.main.dummyengine.model.CombatInformationPanel combatInformationPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    // End of variables declaration//GEN-END:variables
    
}
